<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/js/axios.min.js"></script>
    <script src="/js/util.js"></script>
    <script>
        window.onload = function (){
            initTable();
        }
        function initTable(){
            axios.get("/product/findAll").then(resp =>{
               var info = resp.data;
                var str = "";
               info.forEach(n =>{
                  str += `<tr><td>${n.name}</td><td>${n.price}</td>
                    <td><a href="/product/find.html?id=${n.id}">查询</a></td></tr>`;
               });
               $("data").innerHTML = str;
            });
        }
    </script>
</head>
<body>
    <a href="/product/add.html">添加</a>
    <table border="1" width="80%">
        <thead>
            <tr><th>商品名</th><th>单价</th><th>操作</th></tr>
        </thead>
        <tbody id="data"></tbody>
    </table>
</body>
</html>